//
//  ViewController.m
//  毛玻璃
//
//  Created by TOPTEAM on 2017/4/12.
//  Copyright © 2017年 TOPTEAM. All rights reserved.
//

#import "ViewController.h"
#import "KK3DTouchFuction.h"
#import "UIView+ParentController.h"
@interface ViewController ()

@end

@implementation ViewController

-(void)dealloc{
    [KK3DTouchFuction KK_saveStr:@"P5" withID:@"PP_IMG"];

}

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    if ([KK3DTouchFuction KK_getStr_withID:@"PP_IMG"]) {
        _bgImgView.image = [UIImage imageNamed:[KK3DTouchFuction KK_getStr_withID:@"PP_IMG"]];
    }else{
        _bgImgView.image = [UIImage imageNamed:@"P5"];
    }
    
}



- (void)viewDidLoad {
    [super viewDidLoad];
    
//    毛玻璃的样式(枚举)
//    UIBarStyleDefault          = 0,
//    UIBarStyleBlack            = 1,
//    UIBarStyleBlackOpaque      = 1, // Deprecated. Use UIBarStyleBlack
//    UIBarStyleBlackTranslucent = 2, // Deprecated. Use UIBarStyleBlack and set the translucent property to YES
//    
    _bgImgView = [[UIImageView alloc] initWithFrame:self.view.bounds];
    _bgImgView.image = [UIImage imageNamed:@"P5"];
    [self.view addSubview:_bgImgView];
    
//    UIToolbar *toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, bgImgView.frame.size.width*0.5, bgImgView.frame.size.height)];
//    toolbar.alpha=0.7;
//    toolbar.barStyle = UIBarStyleBlackOpaque;
//    [bgImgView addSubview:toolbar];
//    
    UIToolbar *toolbar2 = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, _bgImgView.frame.size.width, _bgImgView.frame.size.height)];
    toolbar2.alpha=0.3;
    toolbar2.barStyle = UIBarStyleDefault;
    [_bgImgView addSubview:toolbar2];
    
    
    
    
//    UIBlurEffect *effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
//    UIVisualEffectView *effectView = [[UIVisualEffectView alloc] initWithEffect:effect];
//    effectView.frame = CGRectMake(0, 0, bgImgView.frame.size.width*0.5, bgImgView.frame.size.height);
//    effectView.alpha=0.9;
//    [bgImgView addSubview:effectView];
    /*
     * iOS8.0
     毛玻璃的样式(枚举)
     UIBlurEffectStyleExtraLight,
     UIBlurEffectStyleLight,
     UIBlurEffectStyleDark
     
     UIBlurEffect *effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
     UIVisualEffectView *effectView = [[UIVisualEffectView alloc] initWithEffect:effect];
     effectView.frame = CGRectMake(0, 0, bgImgView.frame.size.width*0.5, bgImgView.frame.size.height);
     [bgImgView addSubview:effectView];
     */
    
    [self test_lab];
    
    
}


-(void)test_lab{
    UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(20, 50, CGRectGetWidth([UIScreen mainScreen].bounds)-40, 1000)];
    label.numberOfLines=0;
    label.text = @"dear annan,\n    never did i imagine that i would ever meet you, especially not in the form of a chat friend. a year later i am leading my life with you as your fiance which i could never thought of this very time last year.god has got his own reasons for us to meet and come this far. but i hope our love will flourish beyond what it is right now. distance maybe just a part of the reason why sometimes we think we can't handle this whole relationship, but i am sure our love for each other is way far stronger then any oceans can come across.";
    [self.view addSubview:label];

}
-(void)Change_img{
    if ([KK3DTouchFuction KK_getStr_withID:@"PP_IMG"]) {
        _bgImgView.image = [UIImage imageNamed:[KK3DTouchFuction KK_getStr_withID:@"PP_IMG"]];
    }else{
        _bgImgView.image = [UIImage imageNamed:@"P5"];
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
